package webflux.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author caihe
 * @date 2021/4/15 15:00
 */
@Configuration
public class SwaggerConfig {

    @Bean
    public Docket createResetApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("WebSocket")) //注意修改成自己的包路径，不然扫描不到controller
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("技术分享平台Swagger构建API文档")
                .description("使用RestFul风格, 创建人：caihe")
                .termsOfServiceUrl("www.caihe.site:8080")
                .version("version 1.0")
                .build();
    }

}
